<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>天猫导航</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: pink;
        }

        #box {
            width: 900px;
            height: 63px;
            margin: 100px auto;
            background-color: #fff;
            position: relative;
        }

        #box ul {
            width: 100%;
            height: 100%;
            list-style: none;
            background: url("images/doubleOne.png") no-repeat right center;
            z-index: 1;
            position: absolute;
        }

        #box ul li {
            float: left;
            width: 88px;
            height: 63px;
            line-height: 63px;
            text-align: center;
            cursor: pointer;
        }

        #t_mall {
            background: url("images/tMall.png") no-repeat;
            width: 88px;
            height: 63px;
            position: absolute;
            left: 0;
            top: 0;
        }
    </style>
</head>

<body>
    <div id="box">
        <span id="t_mall"></span>
        <ul>
            <li>双11狂欢</li>
            <li>服装会场</li>
            <li>数码家电</li>
            <li>家具建材</li>
            <li>母婴童装</li>
            <li>手机会场</li>
            <li>美妆会场</li>
            <li>进口会场</li>
            <li>飞猪旅行</li>
        </ul>
    </div>
    <script>
        var box = document.getElementById('box');
        var oul = box.children[1];
        var list = oul.children;
        var tmall = box.children[0];
        var temp = 0;
        for (var i = 0; i < list.length; i++) {
            var ele = list[i];
            ele.onmouseover = function () {
                endX = this.offsetLeft;
            };
            ele.onclick = function () {
                temp = this.offsetLeft;
            };
        }
        box.onmouseout = function () {
            endX = temp;
        };
        var beginX = 0;
        var endX = 0;
        setInterval(function () {
            beginX = beginX + (endX - beginX) / 10;
            tmall.style.left = beginX + 'px';
        }, 10);
    </script>
</body>

</html>